//
//  UINavigationBar+Theme.m
//  夜间模式
//
//  Created by Burn on 2018/10/21.
//  Copyright © 2018年 buren. All rights reserved.
//

#import "UINavigationBar+Theme.h"
#import "ThemeManager.h"
#import "UIView+Theme.h"

@implementation UINavigationBar (Theme)

- (void)changeColor{
//    [super changeColor];
    
    switch ([self.type integerValue]) {
        case ThemeTypeNormal:
            [self setBarTintColor:[ThemeManager shareInstance].themeNormalColor];
            [self setBackgroundColor:[UIColor clearColor]];
            [self setTitleTextAttributes:@{NSForegroundColorAttributeName : [ThemeManager shareInstance].themeBlackColor}];
            break;
        case ThemeTypeRed:
            
            [self setBarTintColor:[ThemeManager shareInstance].themeRedColor];
            [self setBackgroundColor:[UIColor clearColor]];
            [self setTitleTextAttributes:@{NSForegroundColorAttributeName : [ThemeManager shareInstance].themeBlackColor}];
            break;
        case ThemeTypeBlack:
            
            [self setBarTintColor:[ThemeManager shareInstance].themeBlackColor];
            [self setBackgroundColor:[UIColor clearColor]];
            [self setTitleTextAttributes:@{NSForegroundColorAttributeName : [ThemeManager shareInstance].themeBlackColor}];
            break;
        case ThemeTypeClear:
            
            [self setBarTintColor:[ThemeManager shareInstance].themeClearColor];
            [self setBackgroundColor:[UIColor clearColor]];
            [self setTitleTextAttributes:@{NSForegroundColorAttributeName : [ThemeManager shareInstance].themeBlackColor}];
            break;
            
        default:
            break;
    }
    
    
    
    //  改变电池栏style
    if ([ThemeManager shareInstance].isNight) {
        [self setBarStyle:UIBarStyleBlackTranslucent];
    }else{
        [self setBarStyle:UIBarStyleDefault];
    }
}



@end
